package com.gexiaobao.pigeon.ui.fragment.mall.evaluate

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.BaseFragment
import com.gexiaobao.pigeon.databinding.FragmentProductToBeEvaluateBinding
import com.gexiaobao.pigeon.ui.adapter.MyPagerAdapter
import com.gexiaobao.pigeon.viewmodel.EvaluateViewModel
import me.hgj.jetpackmvvm.ext.nav
import me.hgj.jetpackmvvm.ext.util.setOnclickNoRepeat

/**
 * @Author      : hxw
 * @Date        : 2023/7/6 15:01
 * @Describe    : 待评价列表
 */
class FragmentProductToBeEvaluate : BaseFragment<EvaluateViewModel, FragmentProductToBeEvaluateBinding>() {

    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.includeBar.tvWhiteTitle.text = getString(R.string.assessment_center)

        val tabTitles = arrayListOf(getString(R.string.remain_to_be_evaluated), getString(R.string.evaluated))
        val fragments = arrayListOf<Fragment>(FragmentEvaluateList(), FragmentEvaluatedList())
        mDatabind.viewPagerEvaluate.adapter = activity?.let {
            context?.let { it1 ->
                MyPagerAdapter(
                    childFragmentManager,
                    it1,
                    fragments,
                    tabTitles
                )
            }
        }
        mDatabind.viewPagerEvaluate.offscreenPageLimit = 2
        mDatabind.tabLayout.setupWithViewPager(mDatabind.viewPagerEvaluate)
    }


    override fun onBindViewClick() {
        super.onBindViewClick()
        setOnclickNoRepeat(mDatabind.includeBar.ivBack) {
            nav().navigateUp()
        }
    }
}